/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mailprotocol;

import log.ExpertoLog;
import logica.ControladorPrincipal;

/**
 *
 * @author Leandro
 */
public class demonioMail {

    private static ControladorPrincipal c;
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String server="localhost";
        String puerto="110";
        String usr="equipo1@TP2";
        String pass="equipo1";
        String frec="30000";
        if(args.length>0){
        //Validacion de argumentos
        for(int i=0;i<args.length;i++){
            if(args[i].equals("-server")){
                server=args[i+1];
            }
            if(args[i].equals("-port")){
                puerto=args[i+1];
            }
            if(args[i].equals("-usr")){
                usr=args[i+1];
            }
            if(args[i].equals("-pass")){
                pass=args[i+1];
            }
            if(args[i].equals("-frec")){
                frec=args[i+1];
            }
        }
        }
        demonioMail.start(server,usr,pass,frec,puerto);


    }
    
    public static void start(String server,String usr,String pass,String frec,String puerto){
        ExpertoLog.initializeLogger("log4j.xml");
        c=new ControladorPrincipal();
        c.connect(server,
                usr,
                pass,
                Long.parseLong(frec),
                Integer.parseInt(puerto));
    }

    public static void stop(){
    c.stop();
    }

}
